﻿// JScript File

function str(keyCode){
	if ((keyCode >= 32 && keyCode <= 45)
		|| (keyCode == 47)
		|| (keyCode >= 58 && keyCode <= 63)
		|| (keyCode >= 91 && keyCode <= 94)
		|| (keyCode == 96)
		|| (keyCode >= 123 && keyCode <= 126))
	 {
		// For IE only
		// event.returnValue = false; 
		alert("Invalid format!\n\nEmail doesn't allow special charactor and space!!!");
		return false;
	}
}

//************************************************************
// Check email format
// Function_name	: check_email
// Arguments		:
//					- email	: email address
// Actions			: Return true if email is valid
//************************************************************
function validEmail(email){
	//var validEmailStr = /[a-zA-Z0-9]+@[a-zA-Z0-9_-]+\.[a-zA-Z0-9]/;//\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
	var validEmailStr = /\w+([-+.\']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	//var invalidEmailStr = /@\w+@/;
	if(validEmailStr.test(email)){// && !invalidEmailStr.test(email)){
		if(email.indexOf("@")==email.lastIndexOf("@"))
		    return true;
		else
		    return false;
	}else{
		return false;
	}
}
